package com.xmy.cultivate.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.xmy.cultivate.entity.OrderDetail;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xmy.cultivate.entity.Organization;
import com.xmy.cultivate.entity.response.ArrivalRate;
import com.xmy.cultivate.entity.response.OrderDetailRs;
import com.xmy.cultivate.entity.views.EnrollList;
import com.xmy.cultivate.entity.views.FirstSignUp;
import com.xmy.cultivate.entity.views.IncomeDayReport;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 订单报名信息 服务类
 * </p>
 *
 * @author min
 * @since 2022-08-01
 */
public interface IOrderDetailService extends IService<OrderDetail> {


    public abstract IPage<EnrollList> getEnrollList(IPage<?> page, Wrapper wrapper);

    public abstract Map<String, BigDecimal> enrollListMoney(Wrapper wrapper);

    public abstract List<OrderDetail> orderDetail(Wrapper wrapper);

    public abstract Integer getApplyCountForSubjects(Long schoolId, Long studentId, Long subjectsId, Integer newYeartPart, Integer newNum);

    public abstract OrderDetail getLastOneForStudent(Long schoolId, Long studentId, Long subjectsId);

    public abstract List<OrderDetail> GetLessonByStuInfoId(Wrapper wrapper);

    /**
     * 报读通过课程，获取在读信息
     *
     * @param courseId
     * @param studentId
     * @return
     */
    public abstract List<OrderDetail> getLessonByCourseId(Long courseId, Long studentId, Long schoolId);

    /**
     * 获取报读校区
     *
     * @param wrapper
     * @return
     */
    public abstract List<Organization> getSignUpSchoolListForWhere(@Param(Constants.WRAPPER) Wrapper wrapper);

    public abstract FirstSignUp getFirstSignUp(Long studentId, Long gradeId, Integer count);


    public abstract Boolean stopCourse(Long orderDetailId);

    public abstract IPage<IncomeDayReport> getIncomeDayReport(IPage<?> page, Wrapper wrapper);

    List<ArrivalRate> getLosseRade(String yearPart, String quarterNum, String schoolId, String subjectsId, String startDate, String endDate, String type, String lessonType, String yearClassStr);

    List<ArrivalRate> getLosseRadeDetail(String yearPart, String quarterNum, String schoolId, String teacherId, String gradeId, String subjectsId, String startDate, String endDate, String type, String lessonType, String yearClassStr);

    /**
     * 获取报读课程
     *
     * @param wrapper
     * @return
     */
    public abstract OrderDetail getApplyCourse(Wrapper wrapper);

    public abstract OrderDetail getSumResidueCourseHouse(Long courseId, Long studentId, Long schoolId);


    Integer getResidueCourseCountForSubjects1(Long schoolId, Long studentId, Long subjectsId, Integer lessonType);

    List<OrderDetail> getResidueOrderDetail(Long schoolId,
                                            Long studentId,
                                            Long subjectsId,
                                            Integer lessonType
    );


    public IPage<OrderDetailRs> getOrderDetailList(IPage<OrderDetailRs> page, Long createdId, String payType,String yearPart,String  quarterNum,String startDate,String endDate,String schoolId,String subjectsId,String studentName);

    public OrderDetailRs orderDetailForId(Long id);
}
